<?php
namespace Core\Event\Dispatch\Annotation;
use Core\Event\Annotation;
class Before extends Annotation
{
    public function beforeDispatch($event)
    {
        $arguments = $this->_annotation->getArguments();
        $module = isset($arguments['module']) ? $arguments['module'] : null;
        $class = isset($arguments['class']) ? ucfirst($arguments['class']) : null;
        $method = isset($arguments['method']) ? $arguments['method'] : null;
        if (isset($module, $class, $method)) {
            if($this->di->has($module)) {
                $object = $this->di->get($module)->{$class}();
                if(method_exists($object, $method)) {
                    return $object->{$method}();
                }
            }
        }
        return true;
    }
}